﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using Module_Debug.MainForm;
using System.Windows.Forms;

namespace Module_Debug.Others
{
    public partial class PMU_Setting : Form
    {
        public PMU_Setting(frmMain Frm)
        {
            MainForm = Frm;
            InitializeComponent();
            //setting_match();
            this.dataGridView1.Rows[0].Cells[0].Value = MainForm.MAX_VCIC;    //VCI 限流
            this.dataGridView1.Rows[0].Cells[1].Value = MainForm.MAX_VDDIOC;    //VDDIO 限流
            this.dataGridView1.Rows[0].Cells[2].Value = MainForm.MAX_AVDDC;    //AVDD 限流
            this.dataGridView1.Rows[0].Cells[3].Value = MainForm.MAX_ELVSSC;     //ELVSS 限流
            this.dataGridView1.Rows[0].Cells[4].Value = MainForm.MAX_ELVDDC;    //ELVDD 限流
            this.dataGridView1.Rows[0].Cells[5].Value = MainForm.MAX_VBATC;    //VBAT 限流
            this.dataGridView1.Rows[0].Cells[6].Value = MainForm.MAX_DVDDC;    //DVDD 限流
        }



        frmMain MainForm = null;
        class CLASS_Setting
        {
            private int Id;
            private string vale;

            public CLASS_Setting(string y)
            {
            
            }
            public int Id1 { get => Id; set => Id = value; }
            public string Vale { get => vale; set => vale = value; }
        }
        private void setting_match()
        {
            //class C1_setting = new dataGridView1();
            //C1_setting.
            //使用List<>泛型集合填充DataGridView  
            List<CLASS_Setting> students = new List<CLASS_Setting>();
            CLASS_Setting hat = new CLASS_Setting( "205");
            //Student peter = new Student("Peter", "14");
            //Student dell = new Student("Dell", "16");
            //Student anne = new Student("Anne", "19");
            students.Add(hat);
            //students.Add(peter);
            //students.Add(dell);
            //students.Add(anne);
            this.dataGridView1.DataSource = students;
        }

        private void dataGridView1_CellEndEdit(object sender, DataGridViewCellEventArgs e)
        {
            //setting_match();
            MainForm.MAX_VCIC   = Convert.ToInt32(this.dataGridView1.Rows[0].Cells[0].Value);    //VCI 限流
            MainForm.MAX_VDDIOC = Convert.ToInt32(this.dataGridView1.Rows[0].Cells[1].Value);    //VDDIO 限流
            MainForm.MAX_AVDDC  = Convert.ToInt32(this.dataGridView1.Rows[0].Cells[2].Value) ;    //AVDD 限流
            MainForm.MAX_ELVSSC = Convert.ToInt32(this.dataGridView1.Rows[0].Cells[3].Value ) ;     //ELVSS 限流
            MainForm.MAX_ELVDDC = Convert.ToInt32(this.dataGridView1.Rows[0].Cells[4].Value );    //ELVDD 限流
            MainForm.MAX_VBATC  = Convert.ToInt32(this.dataGridView1.Rows[0].Cells[5].Value ) ;    //VBAT 限流
            MainForm.MAX_DVDDC  = Convert.ToInt32(this.dataGridView1.Rows[0].Cells[6].Value ) ;    //DVDD 限流

            //this.dataGridView1.Rows[0].Cells[0].Value = MainForm.MAX_VCIC;    //VCI 限流
            //this.dataGridView1.Rows[0].Cells[1].Value = MainForm.MAX_VDDIOC;    //VDDIO 限流
            //this.dataGridView1.Rows[0].Cells[2].Value = MainForm.MAX_AVDDC;    //AVDD 限流
            //this.dataGridView1.Rows[0].Cells[3].Value = MainForm.MAX_ELVSSC;     //ELVSS 限流
            //this.dataGridView1.Rows[0].Cells[4].Value = MainForm.MAX_ELVDDC;    //ELVDD 限流
            //this.dataGridView1.Rows[0].Cells[5].Value = MainForm.MAX_VBATC;    //VBAT 限流
            //this.dataGridView1.Rows[0].Cells[6].Value = MainForm.MAX_DVDDC;    //DVDD 限流
        }
    }
}
